package com.filter.filterdemo.filterservlet;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

/**
 * @author luheng
 * @create 2019/5/14
 */
public class MyFilter implements Filter {


    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
        MyFilterWrapper myFilterWrapper = new MyFilterWrapper(httpServletRequest);
        filterChain.doFilter(myFilterWrapper, servletResponse);
    }

    @Override
    public void destroy() {

    }
}
